import Koa from 'koa';
import KoaRoute from 'koa-router';
import api from './config/';
import routers from './routers/';
import koaBody from 'koa-body';
const app = new Koa();
const port = api.port;
//定义全局使用的方法
import request from './utility/fetch';
global.fetch = request;
const router = new KoaRoute();
app.use(koaBody({ multipart: true }));
app.use(router.routes());
app.use(router.allowedMethods());
routers(router);

app.listen(port);